package net.neptech.model.sys;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import net.neptech.utils.SnowflakeIdGenerator;
import org.hibernate.annotations.GenericGenerator;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @Author Saya
 * @Date 2025/8/12 15:42
 * @Description TODO
 **/

@Entity
@Table(name = "sys_staff", schema = "med_sys_db")
@TableName("sys_staff")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Staff implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    @Id
    @GenericGenerator(name = "snowflake", type = SnowflakeIdGenerator.class)
    @GeneratedValue(generator = "snowflake")
    @Column(name = "staff_id", nullable = false)
    @TableId
    private Long staffId;

    @Column(name = "user_id")
    private Long userId;

    @Column(name = "dept_id")
    private Long deptId;

    @Column(name = "staff_name")
    private String staffName;

    @Column(name = "staff_phone", columnDefinition = "varchar(15) COMMENT '员工手机号'")
    private String staffPhone;

    @Column(name = "title_id")
    private Long titleId;

    @Column(name = "position_id")
    private Long positionId;

    @Column(name = "join_date")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime joinDate;

    @Column(name = "staff_status", columnDefinition = "byte COMMENT '0正常 1离职 2停诊）'")
    private Byte staffStatus;

    @Column(name = "update_time")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @Column(name = "updater")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updater;
    //头像 url
    @Column(name = "avatar")
    private String avatar;
}
